package china.song314.testcode;

public class TestThread {
	
	public static void main (String[] args) {
		MyThead mt = new MyThead();
		print("isAlive = " + mt.isAlive() + ", isDaemon = " + mt.isDaemon());
		mt.start();
		for (int i = 0; i < 100; i++) {
			try {
				Thread.sleep(300);
			} catch (InterruptedException e) {
			}
			print("isAlive = " + mt.isAlive() + ", isDaemon = " + mt.isDaemon());
		}
	}
	
	static class MyThead extends Thread {

		@Override
		public void run() {
			for (int i = 0; i < 10; i++) {
				try {
					Thread.sleep(1000);
				} catch (InterruptedException e) {
				}
				print("------> run task : " + i);
			}
			
			print("Thread task complete ...");
		}
	}
	
	
	
	static void print(String msg) {
		System.out.println(msg);
	}
}
